package com.minimalist.lindi.controller;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.subsidyapplicationtownpayment.LindiSubsidyApplicationTownPaymentVO;
import com.minimalist.common.response.R;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import com.minimalist.lindi.service.LindiSubsidyApplicationTownPaymentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 林地指标平台_镇街支付明细表控制器
 *
 * @author 11987
 */
@Validated
@RestController
@Tag(name = "林地指标平台_镇街支付明细表管理")
@RequestMapping("/lindi/subsidyApplicationTownPayment")
public class LindiSubsidyApplicationTownPaymentController {

    @Autowired
    private LindiSubsidyApplicationTownPaymentService service;

    @PostMapping("/addSubsidyApplicationTownPayment")
    @Operation(summary = "添加镇街支付明细")
    public R<?> addSubsidyApplicationTownPayment(
            @RequestBody @Validated(Add.class)
            LindiSubsidyApplicationTownPaymentVO subsidyApplicationTownPaymentVO){
        service.addSubsidyApplicationTownPayment(subsidyApplicationTownPaymentVO);
        return R.ok();
    }

    @DeleteMapping("/deleteSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId")
    @Operation(summary = "删除镇街支付明细 -> 根据镇街支付明细ID删除")
    public R<?> deleteSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId(
            @RequestParam("subsidyApplicationTownPaymentId")
            @NotNull(message = "镇街支付明细ID不能为空")
            @Parameter(name = "subsidyApplicationTownPaymentId", required = true, description = "镇街支付明细ID")
            Long subsidyApplicationTownPaymentId){
        service.deleteSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId(subsidyApplicationTownPaymentId);
        return R.ok();
    }

    @PutMapping("/updateSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId")
    @Operation(summary = "修改镇街支付明细")
    public R<?> updateSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId(
            @RequestBody @Validated(Update.class)
            LindiSubsidyApplicationTownPaymentVO subsidyApplicationTownPaymentVO){
        service.updateSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId(subsidyApplicationTownPaymentVO);
        return R.ok();
    }

    @GetMapping("/getSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId/{subsidyApplicationTownPaymentId}")
    @Operation(summary = "根据镇街支付明细ID查询镇街支付明细")
    public R<LindiSubsidyApplicationTownPaymentVO> getSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId(
            @PathVariable(value = "subsidyApplicationTownPaymentId")
            @NotNull(message = "镇街支付明细ID不能为空")
            @Parameter(name = "subsidyApplicationTownPaymentId", description = "镇街支付明细ID", required = true)
            Long subsidyApplicationTownPaymentId){
        return R.ok(service.getSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId(subsidyApplicationTownPaymentId));
    }

    @GetMapping("/getSubsidyApplicationTownPaymentListBySubsidyApplicationPayNoticeId/{subsidyApplicationPayNoticeId}")
    @Operation(summary = "根据支付通知ID查询镇街支付明细列表")
    public R<List<LindiSubsidyApplicationTownPaymentVO>> getSubsidyApplicationTownPaymentListBySubsidyApplicationPayNoticeId(
            @PathVariable(value = "subsidyApplicationPayNoticeId")
            @NotNull(message = "支付通知ID不能为空")
            @Parameter(name = "subsidyApplicationPayNoticeId", description = "支付通知ID", required = true)
            Long subsidyApplicationPayNoticeId){
        return R.ok(service.getSubsidyApplicationTownPaymentListBySubsidyApplicationPayNoticeId(subsidyApplicationPayNoticeId));
    }
}